From: Joey Hess Date: Sat, 25 Oct 2025 09:57:34 +0000 (-0400) Subject: add X-Git-Tag: archive/raspbian/10.20251029-1+rpi1~1^2~3^2~9 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a41dd676318de582a8bbc095f503bb2cbe02ef09;p=git-annex.git add --- diff --git a/doc/special_remotes/p2p/git-annex-p2p-iroh b/doc/special_remotes/p2p/git-annex-p2p-iroh new file mode 100755 index 0000000000..545bdc4166 --- /dev/null +++ b/doc/special_remotes/p2p/git-annex-p2p-iroh @@ -0,0 +1,43 @@ +#!/bin/sh +# Allows git-annex to use iroh for P2P connections. +# +# This uses a modified version of iroh's dumbpipe program, adding the +# generate-ticket command. This pull request has the necessary changes: +# https://github.com/n0-computer/dumbpipe/pull/86 +# +# Quality: experimental. Has worked at least twice, but there are known and +# unknown bugs. +# +# Copyright 2025 Joey Hess; licenced under the GNU GPL version 3 or higher. + +set -e + +git_dir=$(git rev-parse --git-dir) +creds_dir="$git_dir/annex/creds" +iroh_secret_file="$creds_dir/iroh-secret" + +get_iroh_secret () { + IROH_SECRET=$(cat "$iroh_secret_file") + export IROH_SECRET +} + +if [ "$1" = address ]; then + if [ ! -e "$iroh_secret_file" ]; then + mkdir -p "$creds_dir" + umask 077 + gpg --gen-random 16 32 > $iroh_secret_file + fi + get_iroh_secret + # avoid display of the iroh secret to stderr + dumbpipe generate-ticket 2>/dev/null +else + socketfile="$2" + if [ -z "$socketfile" ]; then + # Connect to the peer's address and relay stdin and stdout. + peeraddress="$1" + dumbpipe connect "$peeraddress" + else + get_iroh_secret + dumbpipe listen-unix --socket-path="$socketfile" + fi +fi